package Test0813;

import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        double[] scores = new double[4];
        double sum = 0;
        System.out.println("请输入4位评委的分数");
        for (int i = 0; i < 4; i++) {
            scores[i] = scanner.nextInt();
            if (scores[i] < 0 || scores[i] > 100) {
                System.out.println("分数输入异常，请重新输入");
            }
            sum += scores[i];
        }

        double max = scores[0];
        double min = scores[0];
        for (int i = 0; i < 4; i++) {
            if (scores[i] < min) {
                min = scores[i];
            }
            if (scores[i] > max) {
                max = scores[i];
            }
        }
        double f = (sum - max - min) / 2;

        System.out.println("\n各位评委的打分为：");
        for (int i = 0; i < 4; i++) {
            System.out.printf("评委%d: %.1f分\n", (i + 1), scores[i]);
        }

        System.out.printf("\n最高分: %.1f分", max);
        System.out.printf("\n最低分: %.1f分", min);
        System.out.printf("\n最终平均分(去掉最高最低分): %.2f分\n", f);

        scanner.close();

        }
    }

